package com.freemyleft.left.left_app.mian.index.my.accept_setup.address_managerment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.freemyleft.left.left_app.R;
import com.freemyleft.left.left_app.R2;
import com.freemyleft.left.left_app.mian.index.my.MyRanking.adapter.MyRankingAdapter;
import com.freemyleft.left.left_app.mian.index.my.MyRanking.adapter.MyRankingConvert;
import com.freemyleft.left.zapp.delegates.LeftDelegate;
import com.freemyleft.left.zapp.ui.recycler.MultipleItemEntity;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * 地址管理
 */
public class AddressManagementDelegate extends LeftDelegate {
    @BindView(R2.id.recy)
    RecyclerView recyclerView;
    @Override
    public Object setLayout() {
        return R.layout.delegate_address_management;
    }
    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
        ArrayList<MultipleItemEntity> data =
                new AddreeManagementConvert().convert();
        if (data != null) {
            AddressManagementAdapter adapter = new AddressManagementAdapter(data);
            LinearLayoutManager manager = new LinearLayoutManager(getContext());
            manager.setOrientation(LinearLayoutManager.VERTICAL);
            recyclerView.setAdapter(adapter);
            recyclerView.setLayoutManager(manager);

        } else {
            recyclerView.setVisibility(View.GONE);
        }
    }
    }

